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