UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zr2jfg8c77KvS8GUI6I4htcAB36b1Tr6mH8wQ8V+JoU=' 
WHERE 
  key_id = 'ec1f2063acb2d213880d1611da871c50f72c92538fa216a2e06c79017ed931e1' 
  AND (
    token = 'Zr2jfg8c77KvS8GUI6I4htcAB36b1Tr6mH8wQ8V+JoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034