UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0SkOfKtebK13Cwy36VbBMwOWLcVb9CoOZiuYJMOpd6g='
WHERE
key_id = 'e2d6ec9bc4374a1f9963d417b8465275060d8bec7fc1eb4579774a66b5288ae4'
AND (
token = '0SkOfKtebK13Cwy36VbBMwOWLcVb9CoOZiuYJMOpd6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)