UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd3BbH6Ipy8yIFcmX+CI2OVimiznGE62g5fy4+vOEmnA='
WHERE
key_id = 'd4812012eecf59ec24ff66dcafb0045906e96d0ec898caffeeabac440a369216'
AND (
token = 'd3BbH6Ipy8yIFcmX+CI2OVimiznGE62g5fy4+vOEmnA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)