UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1yXvHi+P+xND3a9OUS6gnq199ukSOO8MnK9fpTC03P8=' 
WHERE 
  key_id = '22d64776223134ab15956f67b04aab31dea940a81745506faea80389945b8257' 
  AND (
    token = '1yXvHi+P+xND3a9OUS6gnq199ukSOO8MnK9fpTC03P8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043