UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ckD/y20LMZShNlHkaVOHzKoNVpNKIcm0okBZp+hrD5Y='
WHERE
key_id = '50e06e172411f0b4faafee9cde0104c0f97289ee0cd94e3e182d75fe451f4b03'
AND (
token = 'ckD/y20LMZShNlHkaVOHzKoNVpNKIcm0okBZp+hrD5Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)