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