UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T30+uOu5zvSUbgkdsLS5NAoC/s6TF+xFSsQ42s51hQg='
WHERE
key_id = 'e44d41339819347a1c4cf30e20a5c4efedae5e50e51d5fa396435152aa2f83d0'
AND (
token = 'T30+uOu5zvSUbgkdsLS5NAoC/s6TF+xFSsQ42s51hQg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)