UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6OlDyQSQki1f6Z2CMvZZ4PuM4BJHLKb1qYvE4czI9Aw='
WHERE
key_id = 'ae2faf85fcebc1003dc1f8c732be48d8588c1c9e1b7cae67066cee40c2f545ab'
AND (
token = '6OlDyQSQki1f6Z2CMvZZ4PuM4BJHLKb1qYvE4czI9Aw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)