UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7aqAeiz9R8tTGr1zss8G34gVh3iIMna3rFuigwGEKR0=' 
WHERE 
  key_id = 'f91ca885cefb6329e556a1e51713fbd4de1e6636cb2f5f4e054cf8a54a82557d' 
  AND (
    token = '7aqAeiz9R8tTGr1zss8G34gVh3iIMna3rFuigwGEKR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030