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