UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JyyaSJeNSyxmTRMFZAytk8ENV5zpmCtP6SnzPD9meAE='
WHERE
key_id = 'b4971ed5c849bb12c3bcecb10623cd616fff6694a6f05744ecc4c925c4f0588a'
AND (
token = 'JyyaSJeNSyxmTRMFZAytk8ENV5zpmCtP6SnzPD9meAE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)