UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y5a2Qj3ihpUIA9PaG03ZVW0Oa6bWsdpkFgGrGh5+Ato=' 
WHERE 
  key_id = 'f31eb8ac8f526cdd798fa7d3114077e04a41188a129693814e16aa56458f945f' 
  AND (
    token = 'Y5a2Qj3ihpUIA9PaG03ZVW0Oa6bWsdpkFgGrGh5+Ato=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023