UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dEnz1DxuuopOff44/fBXVEQC7VXBwJxNAmZ6sYFQaDI='
WHERE
key_id = 'f097795dce5e215bd4df51cc1783ccb18a7c6d4fcaf86a81251992f37c73181b'
AND (
token = 'dEnz1DxuuopOff44/fBXVEQC7VXBwJxNAmZ6sYFQaDI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)