UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '418P+leyQ51V8YDLA9PmTI2mjnJvPVOLo5oN42bKPfY=' 
WHERE 
  key_id = 'f4f01a470fae27c2cdfd410e3b4eedabd0b7c6e038b56305f60144d177945640' 
  AND (
    token = '418P+leyQ51V8YDLA9PmTI2mjnJvPVOLo5oN42bKPfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055