UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pPY+jgczbplQS1PuF+c2uPJc5xZMrOcEKK2V8LR8BWs='
WHERE
key_id = 'efa76cd17fed4ab14fc7fa3ae43ae582e4e90e028056eca843f01417a8f77a2f'
AND (
token = 'pPY+jgczbplQS1PuF+c2uPJc5xZMrOcEKK2V8LR8BWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)