UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yJbyQeKzmxlCkUeoVdL9mI9x43/fJ2PJE2FamD76xOY=' 
WHERE 
  key_id = '8c0d83137e8f0148343274ab79739685a61dc64b6b95a951c36bf49be72745d9' 
  AND (
    token = 'yJbyQeKzmxlCkUeoVdL9mI9x43/fJ2PJE2FamD76xOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031