UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mfEdrqLbt9v0ReTod/cSt3AEvNpglwX61Zw2albZhLo='
WHERE
key_id = 'bb9ec5a1b4ae88a9fdf0c97fa542f0a4476eb3c7f490799788370b530307e354'
AND (
token = 'mfEdrqLbt9v0ReTod/cSt3AEvNpglwX61Zw2albZhLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)