UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qiM0angDFatQMtd+g/3mjCecxXz8MQ1KbOzElLSJS3E=' 
WHERE 
  key_id = 'af765463f70682cdb5862f056770b18b04ea2e7e3c11880c8fe5264d016620af' 
  AND (
    token = 'qiM0angDFatQMtd+g/3mjCecxXz8MQ1KbOzElLSJS3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024