UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UsgwQxoLtFVzaICDG+7p0MrHmQXp+6AGgSItJz0654Y='
WHERE
key_id = '8a144f0c78e60ec35fc16ee90b9c96a3e935daa5fc086b0e421c074ee40bdbae'
AND (
token = 'UsgwQxoLtFVzaICDG+7p0MrHmQXp+6AGgSItJz0654Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)