UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hY8P+rycIUTol58RgATrhaduFzwlyC3Pzso8Lz1rn90='
WHERE
key_id = '583b7ea553b354739ba89f4759c4e25c9772bd421545cbdbf1904949e80a1225'
AND (
token = 'hY8P+rycIUTol58RgATrhaduFzwlyC3Pzso8Lz1rn90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)