UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kiaga8T+XStA2k2CM09LZscNrD2srJV+UFkROSayJVk=' 
WHERE 
  key_id = '43354f4eb4044a2e8f55115867b5d549b567389b4b0b6a8ec14011ddcf3853af' 
  AND (
    token = 'Kiaga8T+XStA2k2CM09LZscNrD2srJV+UFkROSayJVk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026