UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CW3EiVXJ3B1tj8sG8OHU6fL8fcKCx48B70ASholl3OI='
WHERE
key_id = 'a3564cf2f286eccfaed1db46cc7ffef242c2e7d2cdbbd7b740e17f10eb774b7f'
AND (
token = 'CW3EiVXJ3B1tj8sG8OHU6fL8fcKCx48B70ASholl3OI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)