UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sn8WM8jyawu1AXpEGqlxO0e+ApNwSNedJ9z00fm0u2w=' 
WHERE 
  key_id = 'de187e62505baa5248d1648f211ef1aac9497e0c5e4dd5287fb9f41e61894504' 
  AND (
    token = 'Sn8WM8jyawu1AXpEGqlxO0e+ApNwSNedJ9z00fm0u2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024