UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v807KUhl+2ILssxFes0cM/52MNk9Lu+QpXbmOr2rTRo='
WHERE
key_id = '3798b8ae95e2afd43b7460cc450cc9c5b6b51cf182d04488a7d65fa840d9e0df'
AND (
token = 'v807KUhl+2ILssxFes0cM/52MNk9Lu+QpXbmOr2rTRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)