UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PhGrw8kKwU6LDioG5v19eD/3Jto61WTkHMI8b1oo3MA='
WHERE
key_id = 'ba88f25ce1c37abea1edf0512fb1b877330770a0fd9280bc3f18036e0f589404'
AND (
token = 'PhGrw8kKwU6LDioG5v19eD/3Jto61WTkHMI8b1oo3MA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)