UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4tAgraXOhnXBSYWhClAgjWsLw/Vx+EkR0nZMiX+kZ48='
WHERE
key_id = 'b36da3a2457a1f606cf11af5a4a78f0ba5931c1c0d330904f08396440ff52cdb'
AND (
token = '4tAgraXOhnXBSYWhClAgjWsLw/Vx+EkR0nZMiX+kZ48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)