UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iF4OmKuSeBWV19WmLuVHvh3EPzozZtWyYvHrnhhXp0I=' 
WHERE 
  key_id = 'f0af9f30e50bbfdca047e6e87a1b48eb5f2a804f2e4d189515ff794d6758581b' 
  AND (
    token = 'iF4OmKuSeBWV19WmLuVHvh3EPzozZtWyYvHrnhhXp0I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024