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