UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XINzLUAIbKyWXscAlfinNuGpSCytNT18Gl98q9M345g='
WHERE
key_id = '797e9ab7d0877b0f9979ccd93715d038da83267bf71cc10b4f1f11b5f1de3e40'
AND (
token = 'XINzLUAIbKyWXscAlfinNuGpSCytNT18Gl98q9M345g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)